
/**
 * Created by ys on 2018/1/30.
 */
document.write('<script type="text/javascript" src="'+getRootPath()+'/crm/plugin/jquery-3.3.1.js" charset="UTF-8"></script>')||window.jquery

function getRootPath() {
    //获取服务器端口号后面的路径:"/crm/crm/elementUi/helloWord.html"
    var pathName = window.document.location.pathname;
    //获取服务器名称+端口号:"http://localhost:8282"
    var origin =  window.document.location.origin;
    //获取带"/"的项目名:/crm
    var projectName = pathName.substring(0,pathName.substr(1).indexOf('/')+1);
    return (origin+projectName);
}
// 获取静态资源路径
function getRootPath1() {
    //获取当前网址，如： http://localhost:8083/uimcardprj/share/meun.jsp
    var curWwwPath = window.document.location.href;
    //获取主机地址之后的目录，如： uimcardprj/share/meun.jsp
    var pathName = window.document.location.pathname;
    var pos = curWwwPath.indexOf(pathName);
    //获取主机地址，如： http://localhost:8083
    var localhostPaht = curWwwPath.substring(0, pos);
    //获取带"/"的项目名，如：/uimcardprj
    var projectName = pathName.substring(0, pathName.substr(2).indexOf('/') + 2);
    return (localhostPaht + projectName);
}